<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div class="container">
		<ul class="news">
			
		</ul>

		<button class="show">show news</button>
	</div>
	

	<script>
		$('.show').addEventListener('click',function(){
			var script = document.createElement("script")
script.src = 'http://127.0.0.1:8080/getNews?callback=appendHtml'
console.log(this)
			document.head.appendChild(script)
			document.head.removeChild(script)
		})


		function appendHtml(news){
			var html = ''
			for (var i = 0; i < news.length; i++) {
				html += '<li>' + news[i] + '</li>'
			}
			console.log(html)
			$('.news').innerHTML = html
		}


		function $(selector){
			return document.querySelector(selector)
		}
	</script>
</body>
</html>